{#{% extends 'public/base.html' %}#}
{% extends 'index/index.html' %}
{% block hello %}
{% import "public/fenye.html" as macros %}
<div class="tpl-content-wrapper ">
    <div class="tpl-content-page-title"></div>
    <div class="tpl-portlet-components">
        <form action="{{ url_for('medical.search') }}">
            <div class="navbar-form" style="text-align:center">
                <div class="form-group">
                    <input type="text" name="q" class="form-control" placeholder="请输入就诊号"
                           style="width: 250px;">
                    <button type="submit" class="btn btn-default">查找</button>
                </div>
            </div>
            <a href="{{ url_for('medical.add_case') }}">
                <input type="button" class="am-btn am-btn-default am-btn-success" value="添加患者病例"></a>
            <div class="portlet-title">
                <div class="caption font-green bold">
                </div>
            </div>

            {% with messages = get_flashed_messages() %}
            {% if messages %}
            <ul class='flashes'>
                {% for message in messages %}
                <li style="color: #b92c28;">{{ message }}</li>
            </ul>
            {% endfor %}
            {% endif %}
            {% endwith %}

            <table class="am-table am-table-striped am-table-hover table-main" style="width: 90%">
                <thead>
                <tr>
                    <th></th>
                    <th></th>
                    <th>就诊号</th>
                    <th></th>
                    <th>就诊类型</th>
                    <th></th>
                    <th>就诊时间</th>
                    <!--<th>主诉</th>-->
                    <!--<th>诊断意见</th>-->
                    <!--<th>治疗意见</th>-->
                    <th>档案姓名</th>
                    <!--<th>过敏史</th>-->
                    <th></th>
                    <th>处方类型</th>
                    <!--<th>存在第三方的医生id</th>-->
                    <!--<th>存在第三方的患者id</th>-->
                    <th></th>
                    <th></th>
                    <th>状态</th>
                    <th></th>
                    <th>存在第三方的病历id</th>
                </tr>
                </thead>
                <tbody>
                {% for row in index_list %}
                <tr>
                    <td>
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                <a href="{{ url_for('medical.user_view',id=row.id) }}"><input type="button"
                                                                                              value="查看"
                                                                                              class="btn btn-primary"
                                                                                              style="background:  #5eb95e;"></a>
                                <a href="{{ url_for('medical.editor',id=row.id) }}"><input type="button" value="编辑"
                                                                                           class="btn btn-primary"></a>
                                <a href="{{ url_for('medical.delete',id=row.id) }}"><input type="button" value="删除"
                                                                                           class="btn btn-danger"></a>
                            </div>
                        </div>
                    </td>
                    {#
                    <td><input type="checkbox" name="name" value="{{row.id}}"></td>
                    #}
                    <td><input type="hidden" name="name" value="{{ row.id }}"></td>
                    <td>{{ row.medical_number }}</td>
                    <!--<td>{{ row.medical_type }}</td>-->
                    <td>
                        {% if row.medical_type==0 %}
                    <td>初诊</td>
                    {% elif row.medical_type==1 %}
                    <td>复诊</td>
                    {% elif row.medical_type==2 %}
                    <td>未知</td>
                    {% elif row.medical_type==3 %}
                    <td>未知</td>
                    {% endif %}
                    <td>
                    <td>{{ row.medical_time }}</td>
                    <!--<td>{{ row.complaint }}</td>-->
                    <!--<td>{{ row.diagnostic }}</td>-->
                    <!--<td>{{ row.treatment }}</td>-->
                    <!--<td>{{ row.health_record_id }}</td>-->
                    <td>{{ row.health_record.real_name}}</td>
                    <!--<td>{{ row.allergy_history }}</td>-->
                    <!--<td>{{ row.prescription_type}}</td>-->
                    <td>
                        {% if row.prescription_type==0 %}
                    <td>普通处方</td>
                    {% elif row.prescription_type==1 %}
                    <td>急诊处方</td>
                    {% endif %}
                    <td>
                        <!--<td>{{ row.outer_doctor_id }}</td>-->
                        <!--<td>{{ row.status }}</td>-->
                    <td>
                        {% if row.status==0 %}
                    <td>未开始</td>
                    {% elif row.status==1 %}
                    <td>已登记</td>
                    {% elif row.status==2 %}
                    <td>已挂号</td>
                    {% elif row.status==3 %}
                    <td>已开病历</td>
                    {% elif row.status==4 %}
                    <td>已开方</td>
                    {% elif row.status==5 %}
                    <td>已审方</td>
                    {% elif row.status==6 %}
                    <td>已收费</td>
                    {% elif row.status==7 %}
                    <td>已发药</td>
                    {% elif row.status==10 %}
                    <td>已作废</td>
                    {% elif row.status==11 %}
                    <td>无预约医生</td>
                    {% endif %}
                    <td>
                    <td>{{ row.outer_id }}</td>
                </tr>
                {% endfor %}
                </tbody>
            </table>
            <nav aria-label="Page navigation" class="pull-right">
                <ul class="pagination">
                    {{ html|safe }}
                </ul>
            </nav>
        </form>
    </div>
</div>
{% endblock %}